classes = [
    {"name": "n_1", "age": 24, "grade": "A"},
    {"name": "n_2", "age": 23, "grade": "B"},
    {"name": "n_3", "age": 28, "grade": "A"},
    {"name": "n_4", "age": 24, "grade": "A"},
    {"name": "n_5", "age": 25, "grade": "C"},
    {"name": "n_6", "age": 21, "grade": "D"},
    {"name": "n_7", "age": 27, "grade": "A"},
]

# 给定一个列表, 根据grade来排序
print(sorted(classes,key=lambda x: x['grade']))

# 通过filter语句来筛选出Grade为A的同学
def A(a):
    return a["grade"] == "A"
print(list(filter(A,classes)))

# 通过map函数将上述同学的age + 1
def addOne(a):
    a["age"] = a["age"] + 1
    return a
print(list(map(addOne,classes)))

# 使用递归函数重构斐波那契函数
n = 0
def s(n):
    if n <= 1:
        return n
    else:
        return s(n-1) + s(n-2)

e = 0
for e in range(10):
    print(s(e))
    e += 1
